package br.ufpe.cin.mac.util;

import java.io.File;
import java.io.FileWriter;

public class Testes {

	
	public static void main(String args[]) {
		
		String name = "middleware.components.Security";
		String[] split = name.split(".");
		System.err.println(split.length);
		try {
			FileWriter out = new FileWriter(new File("ANP.DATA"));
			
			for(int i = 2; i < 87; i++) {
				out.write("http://postos.anp.gov.br/postos/consulta.asp?p=" + i + "&sCnpj=&sRazaoSocial=&sEstado=0&sMunicipio=0&sBandeira=Bandeira+Branca&sProduto=0&sTipodePosto=0&p=&bPesquisar=Pesquisar\n");
					
			}
			out.flush();
		}
		catch(Exception e){
			e.printStackTrace();
		}
		/*try {
			
			File file = new File("t.tmp");
			
			FileOutputStream fileOut = new FileOutputStream(file);
			FileInputStream fileIn = new FileInputStream(file);
	        
			ObjectOutputStream out = new ObjectOutputStream(fileOut);
			ObjectInputStream in =  new ObjectInputStream(fileIn);
			
			Object[] dados = new Object[]{"Osmany"};
			String[] sig = new String[]{String.class.getName()};
			
	        out.writeObject(dados);
	        out.writeObject(sig);
	        
	        byte[] data = new byte[(int)file.length()];
	        in.read(data);
	        System.err.println("Lido");
			
			
			//Data Encryption Standard (DES)
			KeyGenerator keygen = KeyGenerator.getInstance("DES");
			//Gerando chave DES
			SecretKey desKey = keygen.generateKey();
			Cipher desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
			// Initialize the cipher for encryption   
			desCipher.init(Cipher.ENCRYPT_MODE, desKey);   
			
		
			// Encrypt the cleartext   
			byte[] ciphertext = desCipher.doFinal(data);   
			
			out.write(ciphertext);
			in.read(ciphertext);
			// Initialize the same cipher for decryption    
			desCipher.init(Cipher.DECRYPT_MODE, desKey);   
			// Decrypt the ciphertext    
			byte[] cleartext1 = desCipher.doFinal(ciphertext);
			
			out.write(cleartext1);
			
			dados = (Object[])in.readObject();
			
			System.err.println(dados[0]);
			System.err.println(((String[])in.readObject())[0]);
		}
		catch(Exception e){
			e.printStackTrace();
		}*/
	}
}
